( function ( D )
{
    D.makeHideable = function( buttonId, ids, initialState )
    {
        var state = 0, // 0 === opened OR 1 === closed
            button  = document.getElementById( buttonId ),
			originalDisplays = [];
			
		var initDisplays = function()
		{
			for( var i = 0 ; i < ids.length ; i += 1 )
			{
				originalDisplays[ i ] = document.getElementById( ids[ i ] ).style.display;
			}
		}

        var show = function( )
        {
			for( var i = 0 ; i < ids.length ; i += 1 )
            {
                document.getElementById( ids[ i ] ).style.display = originalDisplays[ i ];
            }
        };

		var hide = function( )
        {
			for( var i = 0 ; i < ids.length ; i += 1 )
            {
                document.getElementById( ids[ i ] ).style.display = "none";
            }
        };

        var showOrHide = function ( )
        {
            if( state === 1 )
            {
                show( );
                button.innerHTML = "☞";
                state = 0;
            }
            else
            {
                hide( );
                button.innerHTML = "☝";
                state = 1;
            }
        };

        button.onclick = function ( )
        {
            showOrHide( );
            return false;
        }

        if( initialState === "opened" )
        {
            state = 1;
        }

        if( initialState === "closed" )
        {
            state = 0;
        }

        initDisplays();
		showOrHide( );
    }
} ) ( DESANTI );
